<?php

/**
 * LEAGUEMan
 * 
 * Copyright (C) 2007 Marko Bischof
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$eventtypemap = LM_Eventtypemap::getInstance();

foreach($this->positions AS $position) {
	if(count($this->players[$position->position_id])) { ?>
			
		<table class="contentpane">
			<tr>
				<td colspan="3"  class="sectiontableheader"><?php echo $position->position_name;?></td>
						
		<?php foreach($this->project->getEventtypes() as $e){
				$eventtype = $eventtypemap->getEventtype($e); ?>
				
				<td width="5%"  class="sectiontableheader"><div align="center"><?php echo $eventtype->getIconImage();?></div></td>
			
		<?php } ?>
			
			</tr>
		
		<?php foreach($this->players[$position->position_id] AS $player){ ?>
				
			<tr class="<?php $this->plugin("toggle", "sectiontableentry1", "sectiontableentry2");?>">
				<td width="1%"><?php echo $player->position_number;?></td>
				<td width="19%">
					<a class="nounder" href="<?php echo sefRelToAbs("index.php?option=com_leagueman&func=playerinfo&pid={$player->player_id}&Itemid={$this->Itemid}");?>">
						<?php echo $player->player_name; ?>
					</a>
				</td>
				<td width="20%"><?php $this->plugin("leagueman_get_age", $player->player_born, $player->player_died); ?></td>
				
		<?php foreach($this->project->getEventtypes() as $e){
				$eventtype		= $eventtypemap->getEventtype($e);
				$association	= $eventtype->playermap_association; ?>
				
				<td><div align="center"><?php echo $player->$association; ?></div></td>
		<?php } ?>
				
			</tr>
<?php	} ?>
		</table>
<?php
	}
}
?>
